#include <iostream>
using namespace std;

int main()
{
    int n; cin >> n;
    while(n--)
    {
        int num, ans = 0; cin >> num;
        while(num)
        {
            num &= num - 1;
            ++ans;
        }
        cout << ans << ' ';
    }
    return 0;
}